<!-- include tpl=head_lay -->
<div class="layui-card" id="search_html">
	<div class="layui-card-header">
		{lang搜索}
	</div>
	<div class="layui-card-body">
		<form method="post" class="layui-form" action="{func admin_url order}">
		<div class="layui-form-item">
			<div class="layui-inline">
				<div class="layui-input-inline" id="statuslist">
					<select name="status">
						<option value="">{lang订单状态…}</option>
						<!-- loop from=$statuslist key=$key value=$value id=$tmpid -->
						<option value="{$key}"{if $key == $status} selected{/if}>{$value}</option>
						<!-- /loop -->
					</select>
				</div>
			</div>
			<div class="layui-inline">
				<div class="layui-input-inline">
					<select name="ispaid">
						<option value="">{lang付款状态不限}</option>
						<option value="1"{if $ispaid == 1} selected{/if}>{lang有付款}</option>
						<option value="2"{if $ispaid == 2} selected{/if}>{lang未付款}</option>
					</select>
				</div>
			</div>
			<div class="layui-inline">
				<div class="layui-input-inline" style="width: 120px;">
					<input type="text" name="date_start" value="{$date_start}" id="date_start" placeholder="{lang开始时间}" autocomplete="off" class="layui-input">
				</div>
				<div class="layui-form-mid">-</div>
				<div class="layui-input-inline" style="width: 120px;">
					<input type="text" name="date_stop" value="{$date_stop}" id="date_stop" placeholder="{lang结束时间}" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-inline">
				<div class="layui-input-inline" style="width: 90px;">
					<input type="text" name="price_min" value="{$price_min}" id="price_min" placeholder="{lang最低价格}" autocomplete="off" class="layui-input">
				</div>
				<div class="layui-form-mid">-</div>
				<div class="layui-input-inline" style="width: 90px;">
					<input type="text" name="price_max" value="{$price_max}" id="price_max" placeholder="{lang最高价格}" autocomplete="off" class="layui-input">
				</div>
			</div>
			<!-- if $paylist -->
			<div class="layui-inline">
				<div class="layui-input-inline">
					<select name="paytype" >
						<option value="">{lang支付方式…}</option>
						<!-- loop from=$paylist key=$key value=$value id=$tmpid -->
						<optgroup label="{$value.title}{if $value.wap}_{lang手机端}{/if}">
							<!-- loop from=$value.rslist key=$k value=$v id=$idxx -->
							<option value="{$v.id}"{if $paytype == $v.id} selected{/if}>{$v.title}<!-- if $v.wap -->_{lang手机端}<!-- /if --></option>
							<!-- /loop -->
						</optgroup>
						<!-- /loop -->
					</select>
				</div>
			</div>
			<!-- /if -->
			<div class="layui-inline">
				<div class="layui-input-inline">
					<select name="keytype" onchange="update_keywords(this.value)">
						<option value="">{lang检索类型…}</option>
						<option value="sn"{if $keytype == 'sn'} selected{/if}>{lang订单编号}</option>
						<option value="user"{if $keytype == 'user'} selected{/if}>{lang用户账号}</option>
						<option value="email"{if $keytype == 'email'} selected{/if}>{lang订单邮箱}</option>
						<option value="protitle"{if $keytype == 'protitle'} selected{/if}>{lang产品名称}</option>
						<option value="paytitle"{if $keytype == 'paytitle'} selected{/if}>{lang付款方式名称}</option>
					</select>
				</div>
			</div>
			<div class="layui-inline">
				<div class="layui-input-inline" style="width: 300px;">
					<input type="text" id="keywords" name="keywords" class="layui-input" placeholder="{lang关键字}" value="{$keywords}"{if $keytype == 'time'} onfocus="laydate()"{/if} />
				</div>
			</div>
			<div class="layui-inline">
				<button class="layui-btn layui-btn-sm" lay-submit>
					<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
					{lang搜索}
				</button>
				<a href="{url ctrl=order/}" class="layui-btn layui-btn-sm layui-btn-danger">
					{lang取消搜索}
				</a>
			</div>
		</div>
		</form>
	</div>
</div>
<div class="layui-card">
	<div class="layui-card-header">
		{lang列表}
		<div class="layui-btn-group fr">
			<input type="button" value="{lang创建新订单}" onclick="$.win('{lang创建新订单}','{url ctrl=order func=set/}')" class="layui-btn layui-btn-sm" />
		</div>
	</div>
	<div class="layui-card-body">
		<table id="tablelist" lay-filter="tablelist" lay-data="{escape: false}">
		<thead>
		<tr>
			<th lay-data="{field:'id', width:80,fixed:'left',sort:true}">ID</th>
			<th lay-data="{field:'sn', width:240,fixed:'left',sort:true}">订单号</th>
			<th lay-data="{field:'fullname',minWidth:120,sort:true}">联系人</th>
			<th lay-data="{field:'user', minWidth:60}">{lang用户}</th>
			<th lay-data="{field:'price', minWidth:110,sort:true,totalRow:true}">{lang价格}</th>
			<th lay-data="{field:'paid', minWidth:120,totalRow:true}">{lang已付}</th>
			<th lay-data="{field:'unpaid', minWidth:120,totalRow:true}">{lang未付}</th>
			<th lay-data="{field:'qty', minWidth:80,totalRow:true}">{lang产品数}</th>
			<th lay-data="{field:'status', minWidth:80}">{lang状态}</th>
			<th lay-data="{field:'pay_title', minWidth:80}">{lang支付方式}</th>
			<th lay-data="{field:'addtime', minWidth:80}">{lang下单时间}</th>
			<th lay-data="{field:'_action', width:250,fixed:'right',unresize:true}">{lang操作}</th>
		</tr>
		</thead>
		<!-- loop from=$rslist key=$key value=$value -->
		<tr id="edit_{$value.id}">
			<td data-id="{$value.id}" data-sn="{$value.sn}" data-unpaid="{$value.unpaid}" data-status="{$value.status}">{$value.id}</td>
			<td>{$value.sn}</td>
			<td><div title="{if $value.mobile}手机：{$value.mobile}{/if}{if $value.mobile && $value.email}&#10;{/if}{if $value.email}邮箱：{$value.email}{/if}">{$value.fullname ? $value.fullname : '-'}</div></td>
			<td><!-- if $value.user --><a href="javascript:$.win('查看用户_#{$value.user.id}','{url ctrl=user func=show id=$value.user.id/}');void(0)">{$value.user}</a><!-- else --><span class="red">{lang游客}</span><!-- /if --></td>
			<td>{func price_format $value.price $value.currency_id $value.currency_id}</td>
			<td>{func price_format $value.paid $value.currency_id $value.currency_id}</td>
			<td{if $value.unpaid} class="red"{/if} data-unpaid-text="{$value.id}"><!-- if $value.unpaid -->{func price_format $value.unpaid $value.currency_id $value.currency_id}<!-- /if --></td>
			<td>{$value.qty}</td>
			<td class="status">
				<input type="button" value="{$value.status_title}" onclick="$.admin_order.set_order('{$value.id}','{$value.status}')" class="layui-btn layui-btn-primary layui-btn-xs" />
			</td>
			<td><!-- if $value.pay_title -->{$value.pay_title}<!-- else --><span class="gray">{lang未设置}</span><!-- /if --></td>
			<td>{func time_format $value.addtime}</td>
			<td>
				<div class="layui-btn-group">
					<input type="button" value="{lang查看}" onclick="$.admin_order.show('{$value.id}')" class="layui-btn layui-btn-xs" />
					<input type="button" value="{lang付款}" onclick="$.admin_order.payment({$value.id})" class="layui-btn layui-btn-xs" />
					<input type="button" value="{lang物流}" onclick="$.admin_order.express({$value.id})" class="layui-btn layui-btn-xs" />
					<!-- if $popedom.modify -->
					<input type="button" value="{lang编辑}" onclick="$.win('{lang编辑订单}_#{$value.id}','{url ctrl=order func=set id=$value.id/}')" class="layui-btn  layui-btn-xs" />
						<!-- if $value.paid>0 -->
						<input type="button" value="{lang退款}" onclick="$.win('{lang订单退款}_#{$value.id}','{url ctrl=order func=refund id=$value.id/}')" class="layui-btn  layui-btn-xs layui-btn-warm" />
						<!-- /if -->
					<!-- /if -->
					<!-- if $popedom.delete -->
					<input type="button" value="{lang删除}" onclick="$.admin_order.del({$value.id},'{$value.sn}')" class="layui-btn  layui-btn-xs layui-btn-danger" />
					<!-- /if -->
				</div>
			</td>
		</tr>
		<!-- /loop -->
		</table>
		<div align="center"><!-- include tpl=pagelist --></div>
	</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
	//渲染表头
	var opt = {};
	opt['totalRow'] = true;
	layui.table.init("tablelist",opt);
});
</script>
<!-- include tpl=foot_lay -->